<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>
<html>
<head>
<title></title>
</head>

<body>

	<h1>All User</h1>

	<style>
table {
	border-collapse: collapse;
}

td {
	padding: 0.5em;
	border: 1px solid #ccc;
}
</style>

	<table>

		<tr>
			<td>name</td>
			<td>status</td>
			<td>Options</td>
		</tr>

		<c:forEach items="${userList}" var="user">
			<tr>
				<td>${user.name}</td>
				<td>${user.suspended ? "Suspenced" :"Active"}</td>
				<td>${user.loginId}</td>
				
				<td>
					<form action="/admin/ChangeUserStatusServlet" method="post">
						<input type='hidden' name='userId' value='${user.key.id}' /> 
					    <input type='hidden' name='suspend' value='${!user.suspended}' />
						<input type='submit' value='${user.suspended ? "activate" :"suspend"}' />
					</form>
				</td>
			</tr>
		</c:forEach>
	</table>

</body>
</html>